package com.xu.cloud.auth.config;

import com.xu.cloud.auth.interceptor.AccessTokenAuthInterceptor;
import com.xu.cloud.auth.service.AccessTokenService;
import com.xu.cloud.common.format.IMessageFormat;
import com.xu.cloud.common.format.Slf4JMessageFormat;
import com.xu.cloud.common.sequence.ISequence;
import com.xu.cloud.common.sequence.UUIDSequence;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 基础配置类
 *
 * @author xuguan
 * @since 2025/2/23
 */
@Configuration
public class BaseConfig {

    @Bean
    public ISequence sequenceGenerator() {
        return new UUIDSequence();
    }

    @Bean
    public IMessageFormat messageFormat() {
        return new Slf4JMessageFormat();
    }

    @Bean
    public AccessTokenAuthInterceptor accessTokenAuthInterceptor(AccessTokenService accessTokenService) {
        return new AccessTokenAuthInterceptor(accessTokenService);
    }
}
